﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using NetMicro.EventBus.Messages;
using System.Data;

namespace NetMicro.EventBus.Persistences
{
    public interface IDeadLetterMessageStorage
    {
        /// <summary>
        /// 保存死信队列消息
        /// </summary>
        /// <param name="message"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<bool> SaveAsync(MessageStorageTransfer message, IDbTransaction transaction = null,
          CancellationToken cancellationToken = default);

        /// <summary>
        /// 删除到期消息
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<bool> DeleteExpiresAsync(CancellationToken cancellationToken = default);
    }
}
